<?php
if (!defined('BASEPATH'))
	exit('No direct script access allowed');
//公司
class Technician_model extends MY_Model
{
    private $table = 'technician';
	public function __construct()
	{
		parent::__construct($this->table,['type_model']);	
		
	}
	//获取列表
	public function getList($where=[],$select='',$dbArray=[]){
	    $this->db->where(['is_delete'=>0,'issue'=>1]);     //未删且发布
	    $this->db->join('type as job','job.typeId=technician.jobId','left');
	    
	    return $this->getWhere($where,$select,$dbArray);	    
	}
	//获取技师数据
	public function getTechnician($companyId){
	    $select='technicianId,realName,judge,job.typeName as jobName,concat("'.IMAGEHOST.'",poster) as poster,giftNum,
                sevriceNo,tags,skill,workStatus';
	    
	    $technician=$this->technician_model->getList(['companyId'=>$companyId],$select);
	    foreach ($technician as $key=>$val){
	        $technician[$key]['skill']=$this->type_model->getSkill(explode('|', $val['skill']));
	    }
	    return $technician;
	}
	//获取技师详情数据
	public function getDetail($technicianId){
	    $select='technicianId,realName,judge,job.typeName as jobName,concat("'.IMAGEHOST.'",poster) as poster,
                concat("'.IMAGEHOST.'",avatar) as avatar,giftNum,sevriceNo,tags,skill,workStatus,signature,commentNum,zanNum';
	    $this->db->join('type as job','job.typeId=technician.jobId','left');
	    $technician=$this->getWhereRow(['technicianId'=>$technicianId],$select);	
	    $technician['skill']=$this->type_model->getSkill(explode('|', @$technician['skill']));
	    return $technician;
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
}
?>